:bug: Fix Bug: MchInfoEncryptLogInfo.MultipleObjectsReturned

Kimi.Huang 5 years ago
parent
commit
544e466ec1
3 changed files with 6 additions and 0 deletions
  1. 2 0
      api/encrypt_views.py
  2. 2 0
      api/mch_views.py
  3. 2 0
      commands/management/commands/hb.py

+ 2 - 0
api/encrypt_views.py

@@ -124,6 +124,8 @@ def decrypt(request):
124 124
         elog = MchInfoEncryptLogInfo.objects.get(sn=sn)
125 125
     except MchInfoEncryptLogInfo.DoesNotExist:
126 126
         elog = None
127
+    except MchInfoEncryptLogInfo.MultipleObjectsReturned:
128
+        elog = None
127 129
 
128 130
     return response(200, data={
129 131
         'plaintext': plaintext,

+ 2 - 0
api/mch_views.py

@@ -389,6 +389,8 @@ def consumer_info_api(request):
389 389
         elog = MchInfoEncryptLogInfo.objects.select_for_update().get(sn=serialNo)
390 390
     except MchInfoEncryptLogInfo.DoesNotExist:
391 391
         elog = None
392
+    except MchInfoEncryptLogInfo.MultipleObjectsReturned:
393
+        elog = None
392 394
 
393 395
     if elog and not dupload:
394 396
         amount = 100

+ 2 - 0
commands/management/commands/hb.py

@@ -38,6 +38,8 @@ class Command(CompatibilityBaseCommand):
38 38
                         elog = MchInfoEncryptLogInfo.objects.select_for_update().get(sn=v.get('sn', ''))
39 39
                     except MchInfoEncryptLogInfo.DoesNotExist:
40 40
                         continue
41
+                    except MchInfoEncryptLogInfo.MultipleObjectsReturned:
42
+                        continue
41 43
 
42 44
                     try:
43 45
                         user = UserInfo.objects.get(user_id=v.get('user_id', ''))